package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.BpEmergencyExerciseRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import java.util.List;

public interface BpEmergencyExerciseRecordDao extends JpaRepository<BpEmergencyExerciseRecord, Long>, QuerydslPredicateExecutor<BpEmergencyExerciseRecord> {
    Page<BpEmergencyExerciseRecord> findAll(Specification<BpEmergencyExerciseRecord> spec, Pageable pageable);

    @Modifying
    @Query(value = "UPDATE wwyt_bp_emergency_exercise_record SET delete_flag ='1' WHERE id IN ?1", nativeQuery = true)
    void deleteByIds(List<Long> ids);
}
